package org.zhss.demo.redis.hyperloglog;

import redis.clients.jedis.Jedis;

public class GarbageContentFilterDemo {

  private Jedis jedis = new Jedis("192.168.150.201");

  /**
   * 判断当前内容是否是垃圾内容
   *
   * @param content
   * @return
   */
  public Boolean isGarbageContent(String content) {
    return jedis.pfadd("hyperloglog_content", content) == 0;
  }

  public static void main(String[] args) {
    GarbageContentFilterDemo demo = new GarbageContentFilterDemo();
    String content = "正常的内容";
    System.out.println("是否为垃圾内容：" + (demo.isGarbageContent(content) ? "是" : "否"));

    content = "垃圾内容";
    System.out.println("是否为垃圾内容：" + (demo.isGarbageContent(content) ? "是" : "否"));

    content = "垃圾内容";
    System.out.println("是否为垃圾内容：" + (demo.isGarbageContent(content) ? "是" : "否"));
  }
}
